package com.springboot.bigevent.conrtoller;

import com.springboot.bigevent.pojo.Result;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.IOException;

@RestController
public class FileUploadController {

    @PostMapping("/upload")
    public Result<String> upload(MultipartFile file) throws IOException {

        //把文件存储在本地磁盘上
        String originalFilename = file.getOriginalFilename();
        file.transferTo(new File("D:\\大三上\\web\\开源1\\big-event\\Files\\"+originalFilename));
        return Result.success("URL访问地址：...");
    }
}
